$(() => {
  const tpl = `
    {{ each data v }}
    <li>
      <a href="/detail.html?id={{ v._id }}">
        <img src="{{ v.thumbnail }}" alt="">
        <span>{{ v.title }}</span>
      </a>
    </li>
    {{ /each }}
  `

  $.ajax({
    type: 'GET',
    url: '/posts/recommend',
    success(res) {
      $('#recommendBox').html(template.render(tpl, { data: res }))
    }
  })
})
